package com.iweb.day05;

/**
 * @author jay
 * @date 2021/10/31
 * @desc
 */
public class OldMan {
    // 省略属性

    // 喂养
    public void feedAnimal(Animal animal){
        animal.eat();
    }


    public static void main(String[] args) {
        OldMan oldMan = new OldMan();
        // 狗狗对象
        Dog dog = new Dog();
        dog.setName("旺财");
        // 猫咪
        Cat cat = new Cat();
        cat.setName("kitty");
        // 猪
        Pig pig = new Pig();
        pig.setName("小白");
        // 喂养动物
        oldMan.feedAnimal(dog);
        oldMan.feedAnimal(cat);
        oldMan.feedAnimal(pig);
    }
}
